package com.xiyu.service.repository.unit.rank;

import com.xiyu.service.vo.unit.rank.RankPageQueryInput;
import com.xiyu.service.model.unit.rank.UnitRank;
import com.xiyu.service.model.unit.rank.UnitRankTable;
import org.babyfish.jimmer.spring.repository.JRepository;
import org.babyfish.jimmer.Page;

public interface UnitRankRepository extends JRepository<UnitRank, Long> {
    UnitRankTable unitRankTable = UnitRankTable.$;

    default Page<UnitRank> pageQuery(RankPageQueryInput inputVO){
        return
            sql().createQuery(unitRankTable)
                    .where(unitRankTable.name().likeIf(inputVO.getName()))
                    .orderBy(unitRankTable.id())
                    .select(unitRankTable)
                    .fetchPage(inputVO.getPageNo() - 1, inputVO.getPageSize());

    }


}